import pyfiglet
import socket
import sys

# this program scanning ports in local network like wifi
# if port is open it prints

ascii_banner = pyfiglet.figlet_format("PYTHON")
print(ascii_banner)

target = socket.gethostbyname(sys.argv[1])

def main():
	try:
		for port in range(0, 65535):
			s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
			socket.setdefaulttimeout(1)

			result = s.connect_ex((target, port))

			if result == 0:
				print(f"PORT {port} is open")
			s.close()
	except:
		print("EXITING PROGRAM")
		sys.exit()

main()